package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsFeedbackMapper;
import com.qf.pojo.DtsFeedback;
import com.qf.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class FeedbackServiceImpl implements FeedbackService {
    @Autowired
    private DtsFeedbackMapper dtsFeedbackMapper;


    @Override
    public IPage<DtsFeedback> findListByQuery(Integer page, Integer limit, String username, Integer id, String sort, String order) {
        return dtsFeedbackMapper.selectPage(new Page<>(page,limit),new QueryWrapper<DtsFeedback>()
                .eq(id!=null,"id",id)
                .eq("deleted",false)
                .like(!StringUtils.isEmpty(username),"username",username)
                .orderBy(!StringUtils.isEmpty(sort),"ASC".equalsIgnoreCase(order),sort));
    }
}
